<script>
  export default {
    name: 'FormItemConfigProvider',
    provide() {
      return {
        formItemConfig: this.config
      }
    },
    props: {
      reactive: Boolean,
      block: Boolean,
      wrapCol: {
        type: Boolean,
        default: true
      }
    },
    data() {
      return {
        config: {
          block: false,
          reactive: false,
          wrapCol: true
        }
      }
    },
    watch: {
      block: {
        immediate: true,
        handler(newVal) {
          this.config.block = newVal
        }
      },
      wrapCol: {
        immediate: true,
        handler(newVal) {
          this.config.wrapCol = newVal
        }
      },
      reactive: {
        immediate: true,
        handler(newVal) {
          this.config.reactive = newVal
        }
      }
    },
    render() {
      return this.$scopedSlots.default()
    }
  }
</script>
